﻿using System;

using System.Collections.Generic;
using System.Text;

namespace Silvermoon.Controls.Base
{
    public class TreeListView : ListViewBase
    {
        public TreeView TreeView { get; private set; }
        public TreeViewItem Item { get; private set; }

        public TreeListView(TreeView treeView, TreeViewItem item)
            : base()
        {
            Item = item;
            this.TreeView = treeView;
        }

        /// <summary>
        /// Gets or sets the height of a virtual Item. This property is required to determine the maximum value of TopOffset that the ListView can have in virtual mode.
        /// </summary>
        public override int ItemHeight
        {
            get
            {
                return TreeView.ItemHeight;
            }
        }

        protected internal override ItemBase OnAttachItem(int index)
        {
            ItemBase item = TreeView.OnAttachItem(index, this.Item);
            return item;
        }

        protected internal override void OnDetachItem(int index, ItemBase item)
        {
            TreeView.OnDetachItem((TreeViewItem)item, this.Item);
            base.OnDetachItem(index, item);
        }

    }
}
